﻿@using Newtouch.Infrastructure;
@{
    ViewBag.Title = "CancelIndex";
    Layout = "~/Views/Shared/_Index.cshtml";

    //是否和医保交易
    var openYbSett = SysConfigReader.Bool("Inpatient_Sett_OpenYbSett");
    //医保所属地，区分系统将执行何处医保逻辑
    ///var medicalInsurance = SysConfigReader.String("Inpatient_MedicalInsurance");
    //是否和新农合交易
    var openXnhSett = SysConfigReader.Bool("Inpatient_Sett_OpenXnhSett");
    var opr = Newtouch.Common.Operator.OperatorProvider.GetCurrent();
}

@Html.Partial("_YibaoCommonView")
<form name="form1">
    <div class="panel panel-default" style="margin-bottom: -3px;">
        <div class="panel-heading navb-bg">
            筛选条件
        </div>
        <table class="form" style="width:400px;">
            <tr>
                <th class="formTitle">住院号：</th>
                <td class="formValue">
                    <input class="form-control" type="text" id="search_zyh" value="" />
                </td>
                <td class="formTitle" style="width: 40px">
                    <input type="button" class="btn btn-default btn-md btn-default-color" title="选择住院患者" value="查询" onclick="GetPatSerarchView();">
                </td>
                <td class="formValue" style="width:140px">
                    @if (openYbSett == true || openXnhSett == true)
                    {
                        @Html.Partial("YibaoRedCardCommon")
                    }
                </td>

            </tr>
        </table>
    </div>
    <div class="rows" style="margin-top: 1%;margin-bottom: 1%;" id="divPatHospitalizationBillBasicInfo">
        <div class="panel panel-default" style="margin-bottom:0;">
            <div class="panel-heading navb-bg">
                住院患者信息
            </div>
            <table class="form" style="width:96%;">
                <tr>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                    <td class="formTitle">住院号：</td>
                    <td class="formValue">
                        <input class="form-control" disabled readonly="readonly" type="text" id="zyh" />
                    </td>
                    <td class="formTitle">病历号：</td>
                    <td class="formValue">
                        <input class="form-control" disabled readonly="readonly" type="text" id="blh" />
                    </td>
                    <td class="formTitle">患者类型：</td>
                    <td class="formValue">
                        <input class="form-control" disabled readonly="readonly" type="text" id="brxzmc" />
                    </td>
                    <td class="formTitle">住院天数：</td>
                    <td class="formValue">
                        <input class="form-control" disabled readonly="readonly" type="text" id="zyts" />
                    </td>
                </tr>
                <tr>
                    <td class="formTitle">姓名：</td>
                    <td class="formValue">
                        <input class="form-control" disabled readonly="readonly" type="text" id="xm" />
                    </td>
                    <td class="formTitle">性别：</td>
                    <td class="formValue">
                        <input class="form-control" disabled readonly="readonly" type="text" id="xb" />
                    </td>
                    <td class="formTitle">年龄：</td>
                    <td class="formValue">
                        <input class="form-control" disabled readonly="readonly" type="text" id="nlshow" />
                    </td>
                    <td class="formTitle">入院日期：</td>
                    <td class="formValue">
                        <input class="form-control" disabled readonly="readonly" type="text" id="ryrq" />
                    </td>
                </tr>
                <tr>
                    <td class="formTitle">住院科室：</td>
                    <td class="formValue">
                        <input class="form-control" disabled readonly="readonly" type="text" id="ksmc" />
                    </td>
                    <td class="formTitle">床位：</td>
                    <td class="formValue">
                        <input class="form-control" disabled readonly="readonly" type="text" id="cw" />
                    </td>
                    <td class="formTitle">总费用：</td>
                    <td class="formValue">
                        <input class="form-control" disabled readonly="readonly" id="txtZJE" />
                    </td>
                    <td class="formTitle">出院日期：</td>
                    <td class="formValue">
                        <input class="form-control" disabled readonly="readonly" type="text" id="cyrq" />
                    </td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                </tr>
            </table>
        </div>
    </div>
    <div class="rows" style="margin-bottom: 1%;" id="divPatHospitalizationBillFeeInfo">
        <div class="panel panel-default" style="margin-bottom:0;">
            <div class="panel-heading navb-bg">
                结算信息
            </div>
            <table class="form" style="width:96%;">
                <tr>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                    <td class="formTitle">结算类型：</td>
                    <td class="formValue">
                        <input class="form-control" disabled readonly="readonly" type="text" id="txtBillType" value="" />
                    </td>
                    <td class="formTitle">结算金额：</td>
                    <td class="formValue">
                        <input class="form-control" disabled readonly="readonly" type="text" id="txtJSJE" />
                    </td>
                    <td class="formTitle" style="visibility:hidden;">本次金额：</td>
                    <td class="formValue" style="visibility:hidden;">
                        <input class="form-control" disabled readonly="readonly" type="text" id="txtBCJE" />
                    </td>
                    <td class="formTitle" style="visibility:hidden;">已结金额：</td>
                    <td class="formValue" style="visibility:hidden;">
                        <input class="form-control" disabled readonly="readonly" type="text" id="txtYJJE" />
                    </td>
                    <td class="formTitle"></td>
                    <td class="formValue"></td>
                </tr>
                <tr>
                    @*<td class="formTitle">记账支付：</td>
                        <td class="formValue">
                            <input class="form-control" disabled readonly="readonly" type="text" id="txtJZZF" />
                        </td>*@
                    <td class="formTitle">支付金额：</td>
                    <td class="formValue">
                        <input class="form-control" disabled readonly="readonly" type="text" id="txtGRZF" />
                    </td>
                    <td class="formTitle">支付方式：</td>
                    <td class="formValue">
                        <input class="form-control" disabled readonly="readonly" type="text" id="txtXjzffs" />
                    </td>
                </tr>
                <tr>
                    <td class="formTitle">取消原因：</td>
                    <td class="formValue" colspan="5">
                        <input class="form-control" type="text" value="" id="txtCancelReason" />
                    </td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                </tr>
            </table>
        </div>
    </div>
</form>
@Html.Partial("_BottomButtonsView", new Newtouch.HIS.Web.Core.Models.BottomButtonViewModel()
{
    ShowKeyList = new int[] { 4, 8 }
})
<script>
    var openYbSett = '@openYbSett' === 'True'; //开关配置：医保患者是否使用医保交易流程
    var openXnhSett = '@openXnhSett' === 'True'; //开关配置：新农合患者是否使用新农合医保交易流程
    var isYbjyjz; //当前是否走医保交易的就诊
    var isXnhjyjz;//当前是否走新农合交易的就诊
    @*var medicalInsurance = '@medicalInsurance';*@
    var curTime = '@DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")';//当前时间
    var cqPatInfo = {};
    var zyh;
    var jsnm;
    var ybjsh; //医保结算号（结算编号）
    var isybdk = false;
    var ybkCardType = "@((int)EnumCardType.YBJYK)";//医保卡类型
    var xnkCardType = "@((int)EnumCardType.XNK)";//虚拟卡类型
    $(function () {

    });
    $("#readCard").show();
    //回车查询
    $('#search_zyh').keydownEnterEvent(function () {
        ajaxLoadDataResult({ zyh: $('#search_zyh').val() });
    })

    //住院病人查询
    function GetPatSerarchView() {
        $.modalOpen({
            id: "patSearch",
            title: "患者查询",
            url: "/PatientManage/AccountManage/PatSearchView?brzybzType=" + '@((int)EnumZYBZ.Ycy)' + "&t=" + Math.random() + "&zyh=" + '',
            width: "700px",
            height: "600px",
            callBack: function (iframeId) {
                top.frames[iframeId].PatDbGrid(); //在弹出窗口事件
            }//窗口点确定的回调函数
        });
    }

    //手输社保卡号
    function GetPatSbkh() {
        $.modalOpen({
            id: "sbkhInput",
            title: "卡号输入",
            url: "/OutpatientManage/OutpatientReg/OutPatientSbkhInput?t=" + Math.random(),
            width: "300px",
            height: "150px",
            callBack: function (iframeId) {
                top.frames[iframeId].PatSbkhData();
            }
        });
    }
    function ReadCardCall(readCardObj) {
        cqPatInfo.jslx = "2";
        ybIsReadCard = true;
        isybdk = true;
        ajaxLoadDataResult({ kh: readCardObj.yibaoCardInfo.kh, sfz: readCardObj.yibaoCardInfo.qtjz, cardType: readCardObj.ybkCardType, ver: '2' });
    }
    //选择的病人
    function getPatInfoAjax(selePatInfo) {
        ajaxLoadDataResult({ zyh: selePatInfo.zyh });
    }

    //
    var patModel = null;

    //ajax加载数据
    var isLoadingIIII = false;  //是否正在从后台加载数据
    function ajaxLoadDataResult(obj) {
        if (!isLoadingIIII) {
            isLoadingIIII = true;
            zyh = null;
            jsnm = null
            ybjsh = null;
            if (!obj || (!obj.zyh && !obj.kh)) {
                isLoadingIIII = false;
                $.modalAlert("请输入住院号,或先读卡！", 'warning');
                return false;
            }
            $.najax({
                type: "POST",
                url: "/HospitalizationManage/DischargeSettle/GetCancelSettleStatusDetail",
                data: obj,
                dataType: "json",
                success: function (ajaxresp) {
                    //住院病人信息
                    patModel = ajaxresp.data.InpatientSettPatInfo;
                    isYbjyjz = openYbSett && patModel.brxz == '1';

                    isXnhjyjz = openXnhSett &&
                        patModel.brxz == '8' &&
                        patModel.CardType == "@((int) Newtouch.Infrastructure.EnumCardType.XNHJYK)";
                    if (medicalInsurance == "guian") {
                        //且要有医保费用信息
                        isYbjyjz = isYbjyjz && !!ajaxresp.data.YbFee && !!ajaxresp.data.YbFee.prm_yka103;

                        ybjsh = !!ajaxresp.data.YbFee ? ajaxresp.data.YbFee.prm_yka103 : null;
                    }
	                //if (medicalInsurance == "chongqing") {
		            //    //且要有医保费用信息
	                //	isYbjyjz = isYbjyjz && !!ajaxresp.data.CqYbFee && !!ajaxresp.data.CqYbFee.jylsh;

	                //	ybjsh = !!ajaxresp.data.CqYbFee ? ajaxresp.data.CqYbFee.jylsh : null;
	                //}

                    zyh = patModel.zyh;
                    jsnm = ajaxresp.data.LastUnCancelledSett.jsnm;

                    $('#search_zyh').val(zyh);
                    $('#zyh').val(zyh);
                    //住院病人基本信息
                    $('#divPatHospitalizationBillBasicInfo').formSerialize(patModel);
                    $("#xb").val($.getGender(patModel.xb));
                    $("#ryrq").val((patModel.ryrq && patModel.ryrq.length >= 10 ? patModel.ryrq.substring(0, 10) : ""));
                    $("#cyrq").val((patModel.cyrq && patModel.cyrq.length >= 10 ? patModel.cyrq.substring(0, 10) : ""));
                    $("#zyts").val((patModel.zyts && patModel.zyts > 0 ? patModel.zyts.toFixed(1) : ""));
                    $("#nlshow").val(getAgeFromBirthTime({ begin: patModel.csny }).text);

                    $("#txtZJE, #txtJSJE, #txtBCJE, #txtYJJE").val(ajaxresp.data.LastUnCancelledSett.zje.toFixed(2));
                    $("#txtGRZF").val(ajaxresp.data.LastUnCancelledSett.xjzf.toFixed(2));
                    var xjzffsStr = "";
                    rowDataArr = $.jsonWhere(top.clients.SysForCashPayList, function (v) {
                        return v && v.xjzffs == ajaxresp.data.LastUnCancelledSett.xjzffs;
                    });
                    if (rowDataArr && rowDataArr.length == 1) {
                        xjzffsStr = rowDataArr[0].xjzffsmc;
                    }
                    $("#txtXjzffs").val(xjzffsStr);
                    $("#txtJZZF").val((ajaxresp.data.LastUnCancelledSett.zje - ajaxresp.data.LastUnCancelledSett.xjzf).toFixed(2));

                    $('#txtBillType').val('出院结算');
                },
                errorCallback: function (data) {
                    funcDoPageClear();
                },
                complete: function () {
                    isLoadingIIII = false;
                }
            });
        }
    }

    window.newtouch_globalconfig.f4opions = {
        container: "#divPatHospitalizationBillBasicInfo, #divPatHospitalizationBillFeeInfo"
    };

    //清除操作
    var funcDoPageClear = function () {
        newtouch_globalevent_f4();
        zyh = null;
        jsnm = null
        ybjsh = null;
    };

    //提交取消结算
    function newtouch_event_f8() {
        if (!zyh) {
            $.modalAlert("住院号为空，请确认", 'warning');
            return;
        }
        if (!jsnm) {
            $.modalAlert("错误，缺少结算内码", 'warning');
            return;
        }
        if (isYbjyjz) {
            if (!isybdk) {
                $.modalAlert("医保患者取消结算，请先读卡！", 'warning');
                return;
            }
            $.ajax({
                type: "GET",
                url: "/HospitalizationManage/DischargeSettle/GetCancelSettInfo?jsnm=" + jsnm,
                dataType: "json",
                async: false,
                success: function (canceldata) {
                    if (canceldata.state == "error") {
                        $.modalAlert("获取医保患者取消结算信息失败:" + canceldata.message, 'warning');
                        return;
                    }
                    if (cqPatInfo.ybVer == "shanghaiV5") {
                        var DenySettleReturn;
                        var payoptype = {
                            hisId: zyh, 'operatorId': '@(opr.rygh)', 'operatorName': '@(opr.UserName)',
                            'carddata': cqPatInfo.carddata, 'cardtype': cqPatInfo.cardtype, "insuplc_admdvs": cqPatInfo.xzqh,
                            'sflx': "2", 'translsh': canceldata.setl_id, 'totalexpense': "", 'cxly': "1", "xsywlx": "1"
                        };
                        $.ajax({
                            type: "POST",
                            url: "http://127.0.0.1:33333/api/FifthPhaseYiBao/ybInterface_SK01",
                            dataType: "json",
                            data: payoptype,
                            async: false,
                            success: function (data) {
                                DenySettleReturn = eval('(' + data + ')');
                            }
                        });
                        if (DenySettleReturn.xxfhm === "P001") {
                            debugger;
                            shybhisSubmit(DenySettleReturn.xxnr.translsh);
                        } else {
                            $.modalAlert('住院结算冲正失败：' + DenySettleReturn.fhxx + '【此时医保已经结算成功，请联系his开发商处理】', 'success');
                        }
                    } else {
                        if (canceldata) {
                            $.ajax({
                                type: "POST",
                                url: "http://127.0.0.1:33333/api/YiBao/HospitaUpSettlement_2305",
                                dataType: "json",
                                data: canceldata,
                                async: false,
                                success: function (data) {
                                    cqybjyDenySettleReturn = eval('(' + data + ')');
                                }
                            });
                            if (cqybjyDenySettleReturn.infcode == "0" || cqybjyDenySettleReturn.infcode == 0) {
                                $.ajax({
                                    type: "POST",
                                    url: "http://127.0.0.1:33333/api/YiBao/HospitaUpOutMdtrtinfo_2405",
                                    dataType: "json",
                                    data: canceldata,
                                    async: false,
                                    success: function (data) {
                                        var cxcyReturn = eval('(' + data + ')');
                                        if (cxcyReturn.infcode != '0') {
                                            $.modalAlert('【2305】取消结算成功但【2405】出院撤销失败：' + cxcyReturn.err_msg + '【请联系his开发商处理】', 'success');
                                        }
                                        else {
                                            hisSubmit(true, cqybjyDenySettleReturn.output.setlinfo);
                                        }
                                    }
                                });

                            } else {
                                $.modalAlert('住院结算冲正失败：' + cqybjyDenySettleReturn.err_msg, 'warning');
                                return;
                            }
                        } else {
                            $.modalAlert('取消结算失败，结算表cqyb_OutPut05中无该次结算医保落地数据：结算内码' + jsnm, 'warning');
                            return;
                        }
                        $.loading(false);
                    }
                }
            });
        }
        else {
            hisSubmit();
        }
    }

    function hisSubmit(isYbjyjz, ybBackReturnData) {
        var setl_id = "";
        if (ybBackReturnData != undefined) {
            setl_id = ybBackReturnData.setl_id;
        }
        $.najax({
            url: "/HospitalizationManage/DischargeSettle/DoCancel",
            dataType: "json",
            data: { zyh: zyh, expectedjsnm: jsnm, cancelReason: $.trim($('#txtCancelReason').val()), cancelyblsh: setl_id }, //期望的结算内码 防止过程中变更
            type: "POST",
            success: function (data) {
                if (!!isYbjyjz) {
	                    ybBackReturnData.jsnm = jsnm;
		                $.najax({
			                type: "POST",
			                data: {
			                	entity: ybBackReturnData, jslb: "4"
			                },
			                url: "/OutpatientManage/OutpatCharge/SaveChongQing99HQ",
			                dataType: "json",
			                loading: false,
			                success: function () {

			                }
		                });
                }

                $.modalAlert(data.message, 'success');
                funcDoPageClear();
            }
        });
    }
    function shybhisSubmit(cancelyblsh) {
        $.najax({
            url: "/HospitalizationManage/DischargeSettle/DoCancel",
            dataType: "json",
            data: { zyh: zyh, expectedjsnm: jsnm, cancelReason: $.trim($('#txtCancelReason').val()), cancelyblsh: cancelyblsh }, //期望的结算内码 防止过程中变更
            type: "POST",
            success: function (data) {
                $.modalAlert(data.message, 'success');
                funcDoPageClear();
            }
        });
    }


</script>
<script type="text/javascript">
    //医保逻辑

    //获取结算患者 患者信息
    function funcGetSettPatientInfo(funcSuccCallback) {
        $.najax({
            url: '/HospitalizationManage/DischargeSettle/GetInpatientSettYbPatInfo?zyh=' + patModel.zyh,
            loadingtext: "正在请求患者出院信息，请稍后...",
            type: 'POST',
            success: function (ajaxResp) {
                //
                if (funcSuccCallback) {
                    setTimeout(function () {
                        funcSuccCallback(ajaxResp.data);
                    }, 50);
                }
            }
        });
    }

    //医保预退
    function ybBackSettle(ybBackSettleReq) {
        //结算退回 预退
        var ybjyBackSettReturn;// = $.guianyibao.ZyFeejsht(ybBackSettleReq);
        $.ajax({
            type: "POST",
            url: "http://127.0.0.1:12345/api/YiBao/ZyFeejsht",
            contentType: 'application/json',
            data: JSON.stringify(ybBackSettleReq),
            dataType: "json",
            async: false,
            success: function (data) {
                ybjyBackSettReturn = eval('(' + data + ')');
            }
        });
        //
        $.loading(false);
        if (ybjyBackSettReturn.Code == 0) {
            var ybReturnData = ybjyBackSettReturn.Data;
            ybReturnData.astr_jylsh = ybjyBackSettReturn.jylsh;
            ybReturnData.astr_jyyzm = ybjyBackSettReturn.jyyzm;
            hisSubmit(true, ybReturnData);
        }
        else {
            $.modalAlert(ybjyBackSettReturn.ErrorMsg, 'error');
            return;
        }
    }

    //贵州医保撤销出院办理操作-住院号
    function gzyb_Cyblcx(funcSuccCallback) {
        $.najax({
            url: "/PatientManage/HospiterRes/GetGuianRyblOutInfoByZyh",
            data: { zyh: zyh },
            dataType: 'json',
            async: false,
            success: function (rep) {
                if (rep) {
                    var gzyb_Cyblcx = new Object();
                    gzyb_Cyblcx.prm_akc190 = rep.prm_akc190;//就诊编号
                    gzyb_Cyblcx.prm_aka130 = rep.prm_aka130;//支付类别
                    gzyb_Cyblcx.prm_ykc141 = '@(opr.UserName)';//经办人姓名
                    //gzyb_Cyblcx.prm_aae036 = curTime;//经办时间
                    gzyb_Cyblcx.prm_aae036 = $.getTime();//经办时间
                    $.najax({
                        url: "/Com/GetSysNowDate",
                        data: { format: "yyyy-MM-dd HH:mm:ss" },
                        dataType: 'text',
                        async: false,
                        success: function (strTime) {
                            gzyb_Cyblcx.prm_aae036 = strTime; //经办时间
                        }
                    });
                    gzyb_Cyblcx.prm_yab003 = rep.prm_yab003;//分中心编号
                    gzyb_Cyblcx.prm_aac001 = rep.prm_aac001;//卡号
                    gzyb_Cyblcx.prm_ykb065 = rep.prm_ykb065;//社会保险办法
                    var gzyb_CyblcxOut;// = $.guianyibao.ZyCyblht(gzyb_Cyblcx); //调用出院办理接口
                    $.ajax({
                        type: "POST",
                        url: "http://127.0.0.1:12345/api/YiBao/ZyCyblht",
                        contentType: 'application/json',
                        data: JSON.stringify(gzyb_Cyblcx),
                        dataType: "json",
                        async: false,
                        success: function (data) {
                            gzyb_CyblcxOut = eval('(' + data + ')');
                        }
                    });
                    if (gzyb_CyblcxOut) {
                        if (gzyb_CyblcxOut.Code != 0) {
                            $.loading(false);
                            $.modalAlert(gzyb_CyblcxOut.ErrorMsg, "error");
                            return;
                        }
                    } else {
                        $.loading(false);
                        $.modalAlert("无法获取医保出院办理撤销反馈信息", "error");
                        return;
                    }
                } else {
                    $.loading(false);
                    $.modalAlert("无法获取入院办理医保信息", "error");
                    return;
                }
            }
        });

        $.loading(false);
        //
        if (funcSuccCallback) {
            setTimeout(function () {
                funcSuccCallback();
            }, 50);
        }
    }
</script>
<script type="text/javascript">
    //
 //   function readCard() {
 //if (medicalInsurance == "chongqing") {
 //           GetReadCardInfo(null);
 //       }
 //   }
    //读卡
    @*function GetReadCardInfo(sbkobj) {
        var cardInfo1;
        var cardInfo2;
        var cardInfo3;
        var yibaoCardInfo;
        var patsbkh = null;

         var url = "http://127.0.0.1:33333/api/YiBao/CardecInfo_1161";
        var payoptype = { "mdtrt_cert_type": $('#readCardCardType').val(), "operatorId": '@(opr.rygh)', "operatorName": '@(opr.UserName)', "businessType": "01101", "officeId": "0201", "officeName": "内科" };
        if ($('#readCardCardType').val() === "02") {
            payoptype.mdtrt_cert_no = sbkobj.sbkh;;
            url = "http://127.0.0.1:33333/api/YiBao/CardecInfo_1101";
        }
        else if ($('#readCardCardType').val() === "01") {
            url = "http://127.0.0.1:33333/api/YiBao/CardecInfo_1102";
        }
        $.ajax({
            type: "POST",
            url: url,
            dataType: "json",
            data: payoptype,
            async: false,
            success: function (data) {
                yibaoCardInfo = eval('(' + data + ')');
            }
        });
        $.loading(false);
        if (yibaoCardInfo) {
            if (yibaoCardInfo.infcode == "0") {
                if (!yibaoCardInfo || !yibaoCardInfo.output.baseinfo || !yibaoCardInfo.output.insuinfo[0]) {
                    $.modalAlert("读卡失败:" + yibaoCardInfo.err_msg, 'error');
                    return;
                }
                var ybklx = $('#readCardCardType').val();
                cardInfo1 = yibaoCardInfo.output.baseinfo; //医保基本信息
                cardInfo2 = yibaoCardInfo.output.insuinfo[0];//参保信息
                if (ybklx !== "02") {
                    cardInfo3 = yibaoCardInfo.output.cardecinfo;//卡信息
                    cqPatInfo.ecToken = cardInfo3.ecToken;
                    cqPatInfo.sbkh = cardInfo3.cardno;
                }

                cqPatInfo.xm = cardInfo1.psn_name;
                cqPatInfo.sfzh = cardInfo1.certno;
                cqPatInfo.xzqh = cardInfo2.insuplc_admdvs;
                cqPatInfo.cblb = cardInfo2.psn_type;
                cqPatInfo.xzlx = cardInfo2.insutype;
                cqPatInfo.grbh = cardInfo1.psn_no;
                cqPatInfo.ybklx = ybklx;
                cqPatInfo.jslx = "2";
                yibaoCardInfo.readCardCardType = ybkCardType;
                yibaoCardInfo.kh = ybklx == "03" ? cardInfo3.cardno : null;
                yibaoCardInfo.qtjz = ybklx != "03" ? cardInfo1.certno : null;
                //yibaoCardInfo.kh = ybklx =="01"?cardInfo1.certno:(ybklx=="02" ? cardInfo1.certno:cardInfo3.cardno) ;
                //社保编号 暂作为系统卡号
                isybdk = true;
                ajaxLoadDataResult({ kh: yibaoCardInfo.kh, sfz: yibaoCardInfo.qtjz, cardType: ybkCardType });
            } else {
                $.modalAlert("刷卡失败:" + yibaoCardInfo.err_msg, 'error');
            }
        } else {
            $.modalAlert("刷卡获取医保信息失败！失败原因：医保中心无信息返回，请重试！", 'error');
        }

    }
    $('#readCard i').click(function () {
        if (false) {
            $.modalAlert("等等情况不可以触发读卡", 'warning');
            return;
        }
        setTimeoutReadCard();
    })
    //触发读卡
    function setTimeoutReadCard() {
        $.loading(true, '正在读卡，请稍后…');
        setTimeout("readCard();", 50);
    }*@

    /*****************************************新农合****************************************/
    //选中家庭参合人列表返回数据
    function GetSelectedpatient(obj) {
        if (!!obj) {
            obj.readCardCardType = $('#readCardCardType').val();
            $.ajax({
                type: "POST",
                url: "@Url.Action("GetZyhByGrbm")",
                data: { xnhgrbm: obj.xnhgrbm,sfjs:"1"},
                dataType: "json",
                async: false,
                success: function (resp) {
                    if (!!resp.data) {
                        ajaxLoadDataResult({ zyh: resp.data });
                    }
                    else {
                        $.modalAlert("住院号【" + resp.data + "】还未结算，无法取消出院结算！", 'warning');
                        return;
                    }
                }
            });
        }
    }
</script>